﻿using DAL.Entities;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL.RYGL
{
    public class InOutDAL
    {
        private readonly DataContext _dataContext;

        public InOutDAL(DataContext dataContext)
        {
            _dataContext = dataContext;
        }

        public async Task<InOut> GetAsync(Guid employeeId)
        {
            return await _dataContext.InOuts.Where(x => x.EmployeeId == employeeId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync();
        }

        public async Task CreateAsync(InOut inoutEntity)
        {
            _dataContext.Entry(inoutEntity).State = EntityState.Added;
        }
    }
}
